package com.situ.day11;

import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class FlowLayutDemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame("FlowLayoutDemo");
//		frame.setTitle("BorderLayout");
		JPanel panel = new JPanel();
		frame.add(panel);
		// 设置布局
		panel.setLayout(new FlowLayout(FlowLayout.LEFT));
		JButton button1 = new JButton("张三");
		JButton button2 = new JButton("李四");
		JButton button3 = new JButton("王五");
		JButton button4 = new JButton("赵六");
		JButton button5 = new JButton("小李");
		JButton button6 = new JButton("小明");
		panel.add(button1);
		panel.add(button2);
		panel.add(button3);
		panel.add(button4);
		panel.add(button5);
		panel.add(button6);

		// 设置大小，单位是像素
		// width the new width of this component in pixels
		frame.setSize(500, 400);
		// 设置初始位置
		frame.setLocation(500, 200);
		// 默认是不显示
		frame.setVisible(true);
		// 关闭Frame(设置Frame默认关闭时候的操作，就是当关闭时候退出)
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}
